Skip to content

feat(api): validate required app config items #2472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

emosbaugh
Copy link
Member

@emosbaugh emosbaugh commented Jul 12, 2025

What this PR does / why we need it:

API support and validation for required items

Which issue(s) this PR fixes:

Does this PR require a test?

Does this PR require a release note?


Does this PR require documentation?

Copy link

github-actions bot commented Jul 12, 2025

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-4335a80" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-4335a80?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

@@ -137,7 +137,7 @@ wait_for_pods_running() {
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$timeout" ]; then
kubectl get pods -A -o yaml || true
kubectl get pods -A || true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was too noisy

Comment on lines 190 to 251
// TODO: should an item really not be required if it's hidden?
if item.Hidden || item.When == "false" {
return false
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how KOTS works today

@emosbaugh emosbaugh marked this pull request as ready for review July 14, 2025 00:09
diamonwiggins
diamonwiggins previously approved these changes Jul 14, 2025
Copy link
Member

@diamonwiggins diamonwiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines 30 to 31
configItems := make(map[string]kotsv1beta1.ConfigItem)
configChildItems := make(map[string]kotsv1beta1.ConfigChildItem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigItem vs. ConfigChildItem is sort of confusing. I initially thought that ConfigItem was actually a ConfigGroup. Is ConfigChildItem for select_one/dropdown type of config types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. @sgalsaleh what is ConfigChildItem?

Copy link
Member

@sgalsaleh sgalsaleh Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's for certain config item types like radio and dropdown that have multiple options to select from.

@emosbaugh emosbaugh force-pushed the emosbaugh/sc-126366/enforce-required-items-on-the-config-page branch from ebe2d70 to f4a302c Compare July 14, 2025 19:14
Comment on lines +248 to +250
if item.Hidden {
return false
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -415,3 +481,241 @@ func TestKubernetesGetAppConfigValues(t *testing.T) {
assert.Equal(t, http.StatusUnauthorized, apiError.StatusCode)
})
}

// TestInstallController_SetAppConfigValuesWithAPIClient tests the SetAppConfigValues endpoint using the API client
func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be done in a separate pr

Suggested change
func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
func TestInstallController_PatchAppConfigValuesWithAPIClient(t *testing.T) {

@@ -414,3 +483,241 @@ func TestLinuxGetAppConfigValues(t *testing.T) {
assert.Equal(t, http.StatusUnauthorized, apiError.StatusCode)
})
}

// TestInstallController_SetAppConfigValuesWithAPIClient tests the SetAppConfigValues endpoint using the API client
func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

sgalsaleh
sgalsaleh previously approved these changes Jul 14, 2025
@emosbaugh emosbaugh enabled auto-merge (squash) July 14, 2025 20:38
@emosbaugh emosbaugh merged commit 0a626bf into main Jul 14, 2025
66 checks passed
@emosbaugh emosbaugh deleted the emosbaugh/sc-126366/enforce-required-items-on-the-config-page branch July 14, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants